package com.lsa.letcode.the34.searchRange;

import org.junit.Assert;
import org.junit.Test;

public class SearchRangeTest {
	@Test
	public void test() {
		Solution s = new Solution();
		test(s, new int[] {5, 7, 7, 8, 8, 10}, 8, new int[]{3, 4});
		test(s, new int[] {5, 7, 7, 8, 8, 10}, 7, new int[]{1, 2});
		test(s, new int[] {5, 7, 7, 8, 8, 10}, 10, new int[]{5, 5});
		test(s, new int[] {5, 7, 7, 8, 8, 10}, 5, new int[]{0, 0});
		test(s, new int[] {5, 7, 7, 8, 8, 10}, 15, new int[]{-1, -1});
		test(s, new int[] {5}, 5, new int[]{0, 0});
	}

	private void test(Solution s, int[] arr, int target, int[] expected) {
		Assert.assertArrayEquals(expected, s.searchRange(arr, target));
	}
}